package com.example.demo2.controller;

import com.example.demo2.pojo.data.AnnouncementDO;
import com.example.demo2.pojo.vo.AnnouncementVO;
import com.example.demo2.service.AnnouncementService;
import com.example.demo2.utils.Result;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class IndexController {
    @Resource
    AnnouncementService announcementService;
    @RequestMapping("/index")
public String index (Model model) throws Exception {
        Result result = announcementService.findById(1);
        AnnouncementDO anno = (AnnouncementDO) result.getData();
        model.addAttribute("anno",anno);
        return "index";
    }

}
